package com.hyz.controller;

import com.hyz.pojo.ResponseResult;
import com.hyz.pojo.assetSecondment.AssetSecondmentRequest;
import com.hyz.pojo.assetSecondment.AssetSecondmentResponse;
import com.hyz.service.InformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author HGD
 * @date 2022/10/6 15:30
 */
@RestController
@RequestMapping("/information")
@Api("信息管理部经理")
public class InformationController {
    @Autowired
    private InformationService service;

    @ApiOperation("获取资产调用申请")
    @ApiResponse(code = 200, message = "成功", response = ResponseResult.class)
    @PostMapping("/ifGetAssetSecondment")
    public ResponseResult<List<AssetSecondmentResponse>> ifGetAssetSecondment() {
        return service.ifGetAssetSecondment();
    }

    @ApiOperation(("审批资产调用申请"))
    @ApiResponse(code = 200, message = "成功", response = ResponseResult.class)
    @PostMapping("/ifUpdateAssetSecondment")
    public ResponseResult<List<AssetSecondmentResponse>> ifUpdateAssetSecondment(@RequestBody AssetSecondmentRequest request) {
        if (request.getResult() == null || request.getId() == null) {
            return new ResponseResult<>(500, "失败");
        }
        return service.ifUpdateAssetSecondment(request);
    }
}
